#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <string.h>
unsigned char buf[1024];
int main()
{
	int fd1=open("bootsect",O_RDONLY,0);
	int fd2=open("setup",O_RDONLY,0);
	int fd3=open("vmlongx",O_CREAT|O_RDWR);
	int size1;
	memset(buf,0,1024);
	if((read(fd1,buf,512))!=512)
	{
		printf("there is something wrong in reading bootsect!\n");
		return 0;
	}
	if(write(fd3,buf,512)!=512)
	{
		printf("there is something wrong in writting bootsect\n");
		return 0;
	}
	memset(buf,0,1024);
	while((size1=read(fd2,buf,1024))!=0)
	{
		write(fd3,buf,size1);
		memset(buf,0,1024);
	}
	return 0;
}
